package system

import (
	"github.com/cn-ygf/go-admin/internal/modular/system/controller"
	"github.com/cn-ygf/go-admin/internal/modular/system/middleware"
	"github.com/kataras/iris/v12/mvc"
)

func Router(m *mvc.Application) {
	// 登录业务
	login := m.Party("/login")
	login.Handle(new(controller.LoginController))

	// 用户登录相关业务
	user := m.Party("/user")
	user.Router.Use(middleware.Auth)
	user.Handle(new(controller.UserController))

	system := m.Party("/system")

	profile := system.Party("/profile")
	profile.Router.Use(middleware.Auth)
	profile.Handle(new(controller.ProfileController))

	// 用户管理
	users := system.Party("/users")
	users.Router.Use(middleware.Auth)
	users.Handle(new(controller.UsersController))

	// 角色管理
	role := system.Party("/role")
	role.Router.Use(middleware.Auth)
	role.Handle(new(controller.RoleController))

	// 菜单管理
	menu := system.Party("/menu")
	menu.Router.Use(middleware.Auth)
	menu.Handle(new(controller.MenuController))

	// 部门管理
	dept := system.Party("/dept")
	dept.Router.Use(middleware.Auth)
	dept.Handle(new(controller.DeptController))

	// 岗位管理
	post := system.Party("/post")
	post.Router.Use(middleware.Auth)
	post.Handle(new(controller.PostController))

	// 字典管理
	dictData := system.Party("/dict/data")
	dictData.Router.Use(middleware.Auth)
	dictData.Handle(new(controller.DictDataController))

	dictType := system.Party("/dict/type")
	dictType.Router.Use(middleware.Auth)
	dictType.Handle(new(controller.DictTypeController))

	// 参数配置
	config := system.Party("/config")
	config.Router.Use(middleware.Auth)
	config.Handle(new(controller.ConfigController))

	// 通知公告
	notice := system.Party("/notice")
	notice.Router.Use(middleware.Auth)
	notice.Handle(new(controller.NoticeController))

	// 登录日志
	loginLog := system.Party("/loginlog")
	loginLog.Router.Use(middleware.Auth)
	loginLog.Handle(new(controller.LoginLogController))

}
